#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <setjmp.h>

jmp_buf jmp_buffer;
int gloaval;

void f2() {
	longjmp(jmp_buffer, 1);
}

void f1(int i, int j, int k, int l) {
	printf("in f1():\n");
	printf("gloaval = %d, autoval = %d, regival = %d, "\
		"volaval = %d, statval = %d\n", gloaval, i, j, k, l);
	f2();
}

int main() {
	int autoval;
	register int regival;
	volatile int volaval;
	static int statval;

	gloaval = 1; autoval = 2; regival = 3; volaval = 4; statval = 5;

	if (setjmp(jmp_buffer) != 0)	{
		printf("after longjmp:\n");
		printf("gloaval = %d, autoval = %d, regival = %d, "\
			"volaval = %d, statval = %d\n", gloaval, autoval, regival, volaval, statval);
		exit(0);
	}

	gloaval = 95; autoval=96; regival=97; volaval=98; statval=99;

	f1(autoval, regival, volaval, statval);
	return 0;
}